package springboot.com.dao;


import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;




import springboot.com.entity.Demo;
import springboot.com.repository.DemoRepository;

@Repository
public class DemoDao extends BaseDao<DemoRepository, Demo>{

	@PersistenceContext
    private EntityManager entityManager;
	
	@Resource
    @Override
    public void setJpaRepository(DemoRepository jpaRepository) {
        super.setJpaRepository(jpaRepository);    //To change body of overridden methods use File | Settings | File Templates.
    }

	
	  /**
     * 保存demo实体类
     * 
     * @param UserAcccount
     * Demo
     * @return
     * 
     * @author jianbin.li
     */
    public void register(Demo demo) throws Exception {
    	jpaRepository.save(demo);
		
	}
    /**
     * 根据id返回实体
     * @param id
     * @return
     */
    public Demo findById(Long id){
    	Demo demo = jpaRepository.findById(id);
    	return demo;
    }
    

}
